﻿namespace BLL.Repositories.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class Email : DbMigration
    {
        public override void Up()
        {
            CreateTable(
                "dbo.Emails",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        EmailAddress = c.String(),
                        Code = c.String(),
                        hasValid = c.Boolean(nullable: false),
                    })
                .PrimaryKey(t => t.Id);
            
            AddColumn("dbo.Users", "hasValid", c => c.Boolean(nullable: false));
            AddColumn("dbo.Users", "Email_Id", c => c.Int());
            CreateIndex("dbo.Users", "Email_Id");
            AddForeignKey("dbo.Users", "Email_Id", "dbo.Emails", "Id");
        }
        
        public override void Down()
        {
            DropForeignKey("dbo.Users", "Email_Id", "dbo.Emails");
            DropIndex("dbo.Users", new[] { "Email_Id" });
            DropColumn("dbo.Users", "Email_Id");
            DropColumn("dbo.Users", "hasValid");
            DropTable("dbo.Emails");
        }
    }
}
